<template>
  <div class="userinfo-box">
    <div class="user-top">
      <div class="pic">
        <van-image
            width="80px"
            height="80px"
            fit="cover"
            :src="userRes.img"
        />
      </div>
      <div class="info">
        <div class="one">
          {{userRes.username}}
        </div>
        <div class="two">
          id：{{userRes.userid}}
        </div>
      </div>
    </div>
    <div class="user-services">
      <div class="services-group">
        <div class="item" v-for="(item,index) in serviceList" :key="index" @click="toNext(item.path)">
          <div class="service-name">
            <van-icon :name="item.icon" color="#1dcf91" size="23"/>
          </div>
          <div class="four">
            <div class="service-to">
              {{item.name}}
            </div>
            <div class="three">
              <van-icon name="arrow" color="#b8b8b8" size="23" />
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import {reactive} from "vue"
import {useRouter} from "vue-router"

// 路由
const router = useRouter()

const userRes = reactive({
  img:require("@/assets/images/User/user.jpg"),
  username:'张三',
  userid:'20240116zs'
})

const serviceList = reactive([
  {
    icon:'notes-o',
    name:'详细资料',
    path:'/more'
  },{
    icon:'records-o',
    name:'编辑资料',
    path:'/edit'
  },{
    icon:'setting-o',
    name:'设置',
    path:'/setting'
  },
])

// 向下一级路由跳转
const toNext = (path) => {
  router.push(path)
}
</script>

<style scoped lang="less">
.userinfo-box{
  .user-top{
    height: 230px;
    background-color: #fff;
    display: flex;
    padding-top: 200px;
    padding-left: 50px;
    align-items: start;
    font-size: 30px;
    .info{
      display: flex;
      flex-direction: column;
      margin-left: 35px;
      .one{
        text-align: left;
        font-size: 38px;
        font-weight: bold;
        letter-spacing: 2px;
        padding-top: 15px;
      }
      .two{
        text-align: left;
        margin-top: 25px;
        color: gray;
      }
    }
  }
  .user-services{
    font-size: 30px;
    .services-group{
      margin-top: 40px;
      .item{
        height: 100px;
        box-sizing: border-box;
        background-color: #fff;
        display: flex;
        justify-content: space-between;
        width: 100%;
        padding: 25px 25px 0 25px;
        align-items: center;
        text-align: center;
        &:last-child{
          border-bottom: 1px solid #ededed;
        }
        .service-name{
          vertical-align: center;
          padding-bottom: 28px;
          margin-right: 5%;
        }
        .four{
          display: flex;
          justify-content: space-between;
          width: 95%;
          border-bottom: 1px solid #ededed;
          padding-bottom: 25px;
          letter-spacing: 2px;
        }
      }
    }
  }
}
</style>